<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>Promise-API- Promise.prototype.catch方法使用</h1>
    <script>
        /*
            Promise.prototype.catch方法: (onRejected) => {}
            (1) onRejected函数: 失败的回调函数 (reason) => {}
            说明: then()的语法糖, 相当于: then(undefined, onRejected) 的一半
        */

        const p = new Promise((resolve, reject)=>{
            resolve("aaa");
            //reject("error");
        });

        console.log(p);

        // Promise的catch回调操作
        p.catch(reason => {
            console.log("操作失败！", reason);
        });
    </script>
</body>
</html>